package com.ibp.comparator;

import java.util.Comparator;

import com.ibp.entity.SysRunManage;
import com.ibp.utils.StringUtil;

public class ComparatorSRM implements Comparator<SysRunManage> {

	  @Override
	  public int compare(SysRunManage o1, SysRunManage o2) {
			String sn1 = StringUtil.isEmpty(o1.getSessionNode())?"z":o1.getSessionNode();
			String sn2 = StringUtil.isEmpty(o2.getSessionNode())?"z":o2.getSessionNode();
			String st1 = StringUtil.isEmpty(o1.getSessionType())?"z":o1.getSessionType();
			String st2 = StringUtil.isEmpty(o2.getSessionType())?"z":o2.getSessionType();
			int flag = sn1.compareTo(sn2);
			if(flag == 0){
				return ("ibma".equals(st1)?"A":st1).compareTo(("ibma".equals(st2)?"A":st2));
			}else{
				return flag ;
			}
	  }
}
